package labmanager.services;

import java.util.ArrayList;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.ws.Response;
import labmanager.business.LabManagerTypeReservation;
import labmanager.business.LabManagerUser;
import org.apache.log4j.Logger;

import dto.ResponseDTO;
import dto.UserDTO;

@WebService()
public class WSLabManager {

	private static Logger logger = Logger.getLogger(WSLabManager.class);
	public WSLabManager() {
	}

	@WebMethod(operationName = "loginUser")
	public ResponseDTO loginUser(@WebParam(name = "user_name") String user_name,
			@WebParam(name = "password") String password) {

		LabManagerUser labmanager = new LabManagerUser();
		return labmanager.loginUser(user_name, password);
	}
	
	@WebMethod(operationName = "createUser")
	public ResponseDTO createUser(@WebParam(name = "request") UserDTO request) {

		LabManagerUser labmanager = new LabManagerUser();
		return labmanager.createUser(request);
	}
	
	@WebMethod(operationName = "listUsers")
	public ArrayList<String> listUsers(@WebParam(name = "where") String where) {

		LabManagerUser labmanager = new LabManagerUser();
		return labmanager.listUsers(where);
	}
	
	@WebMethod(operationName = "updateUser")
	public ResponseDTO updateUser(@WebParam(name = "code") int code, @WebParam(name = "name") String name, 
			@WebParam(name = "lastName")String lastName, @WebParam(name = "userName") String userName,
			@WebParam(name = "password")String password, @WebParam(name = "state") int state, @WebParam(name = "profileId") int profileId) {

		LabManagerUser labmanager = new LabManagerUser();
		return labmanager.updateUser(code, name, lastName, userName, password, state, profileId);
	}
	
	@WebMethod(operationName = "listTypeReservation")
	public ArrayList<String> listTypeReservation(@WebParam(name = "where") String where) {

		LabManagerTypeReservation labmanager = new LabManagerTypeReservation();
		return labmanager.listTypeReservation(where);
	}

}
